package com.itheima.appserver.service;

import com.itheima.commons.constants.Constants;
import com.sun.org.apache.bcel.internal.classfile.ConstantString;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

/**
 * @ClassName: IdService
 * @Description:
 * @Author: Administrator
 * @Date: 2021/12/8 10:29
 */
@Service
public class IdService {

    @Autowired
    RedisTemplate<String, String> redisTemplate;

    public Long createId(String type){

    // 对圈子生成一个id  PUBLISH
    // TANHUA_UNIT_ID_PUBLISH   123

    // 对圈子生成一个id  VEDIO
    // TANHUA_UNIT_ID_VEDIO   3
    return redisTemplate.opsForValue().increment(Constants.TANHUA_UNIT_ID_+type);

}
}
